{include file='common/head'}
<!--员工发布&#45;&#45;说天喊地-->
<div style="overflow-x: hidden;width: 96%;margin: auto;padding-top: 1rem;">
    <blockquote class="layui-elem-quote layui-text">
        <div class="demoTable layui-form">
            <!--<table class="layui-hide" id="LAY_table_user" lay-filter="user"></table>-->
            <div class="demoTable layui-form">
                <div class="layui-input-inline">
                    <input type="text" placeholder="请输入报案号" name="policy_num" lay-verify="required|phone"  autocomplete="off" class="layui-input">
                </div>
                <button class="layui-btn " data-type="reload" ><i class="layui-icon">&#xe615;</i>搜索</button>
                <!--<button class="layui-btn addInfo">添加</button>-->
            </div>
        </div>
    </blockquote>
    <div class="layui-tab" lay-filter="test">
        <ul class="layui-tab-title">
            <li lay-id="1" class="layui-this">未递交审核</li>
            <li lay-id="2">待审核</li>
            <li lay-id="3">驳回修改</li>
            <li lay-id="4">已完成</li>
        </ul>
    <div class="demoTable layui-for">
        <table class="layui-table" lay-data="{height: 'full-150', url:'{$url}',edit:true, page:true, id:'testReload',loading:true}" lay-filter="demo">
            <thead>
            <tr>
                <th lay-data="{field:'company_name',width:220}">所属公司</th>
                <th lay-data="{field:'username',width:180}">物权人</th>
                <th lay-data="{field:'policy_num',width:180}">报案号</th>
                <th lay-data="{fixed: 'is_hot', width:400,fixed: 'right', align:'left', toolbar: '#barDemo'}">操作</th>
            </tr>
            </thead>
        </table>
        <script type="text/html" id="barDemo">
            {{#  if(d.status == 4){ }}
            <a class="layui-btn layui-btn-xs" lay-event="look">查看授权书</a>
            <a class="layui-btn layui-btn-xs" lay-event="look_bol">查看提货单</a>
            {{#  } }}
            <a class="layui-btn layui-btn-xs" lay-event="edit">详细资料</a>
        </script>
        <script type="text/html" id="contentTpl" lay-event="detail_content">
            <span>{{ d.describe }}</span>
        </script>

        <script type="text/html" id="recordor_id">
            {{#  if(d.recordor_id > 0){ }}
            <span >是</span>
            {{#  } }}
            {{#  if(d.recordor_id == 0){ }}
            <span >否</span>
            {{#  } }}
        </script>
    </div>
    </div>
    {include file='common/footer'}
    <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
    <script>
        layui.use(['table','form','element','upload'], function(){
            var table = layui.table
                ,form = layui.form
                ,element = layui.element
                ,upload = layui.upload;
            var $ = layui.$, active = {
                reload: function(){
                    var policy_num = $('input[name="report_num"]').val();
                  //  var company_type = $('select[name="company_type"] option:checked').val();
                    //执行重载
                    table.reload('testReload', {
                        where: {
                            policy_num:policy_num,
                        }
                    });
                }
            };

            element.on('tab(test)', function(elem) {
                var status = $(this).attr('lay-id');
                table.reload('testReload', {
                    where: {
                        status: status,
                    }
                });
            });

            $('.demoTable .layui-btn').on('click', function(){
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });

            //监听表格复选框选择
            table.on('checkbox(demo)', function(obj){
                console.log(obj)
            });
            //监听工具条
            table.on('tool(demo)', function(obj){
                var data = obj.data;
                if(obj.event === 'edit'){
                    layer.open({
                        type: 2,
                        title: '详情信息',
                        shadeClose: true,
                        shade: false,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['100%', '100%'],
                        content: '{:url("InsurantMan/step_info")}?policy_num='+data.policy_num,
                        end: function () {
                            table.reload('testReload');
                        },
                    });
                }else if(obj.event === 'look_bol'){
                    if(data.bol_url){
                        window.open(data.bol_url);
                    }else{
                        layer.msg('提货单不存在');
                    }
                }else if(obj.event === 'look'){
                    if(data.entrust_url[0]){
                        window.open(data.entrust_url[0]);
                    }else{
                        layer.msg('授权书不存在');
                    }
                }
            });
        });
    </script>
    </body>
    </html>